<div class="sidebar col-lg-4<%= ' hide-ios' if turbolinks_app? && action_name != 'show' %>" id='sidebar'>
  <div class="card profile">
    <div class="card-body">
      <div class="media">
        <div class="mr-3 avatar media-left">
          <div class='image'><%= user_avatar_tag(@user, :lg, link: false) %></div>
          <div class="level"><%= user_level_tag(@user, show_whole: false) %></div>
        </div>
        <div class="media-body">
          <div class="item">
            <%= @user.fullname %>
            <span class="opts pull-right">
              <% if current_user&.admin? %>
                <%= link_to icon_tag("edit", label: "管理"), edit_admin_user_path(@user.id) %>
              <% end %>
            </span>
          </div>
          <div class="item number">
            第 <%= @user.id %> 位<%= t("menu.users")%> / <span title="注册日期"><%= @user.created_at.to_date %></span>
          </div>
          <% if !@user.company.blank? %>
            <div class="item company">
              <%= @user.company %>
              <% if @user.location.present? %> @ <span title="所在地"><%= location_name_tag(@user.location) %></span><% end %>
            </div>
          <% end %>
          <div class="item counts">
            <span><%= @user.topics_count %></span> 篇帖子 • <span><%= @user.replies_count %></span> 条回帖
          </div>

          <% if current_user && current_user == @user %>
          <div class="item credits">
            <%= link_to  credits_path do %>
            <span class='tw-text-green-500'><%= current_user.credit_sum.to_i%></span> 积分
            <%end %>
          </div>
          <%end%>

          <div class="item social">
            <% if !@user.twitter.blank? %>
              <%= link_to raw('<i class="fab fa-twitter"></i>'), @user.twitter_url, class: "twitter", rel: "nofollow" %>
            <% end %>
            <% if !@user.website.blank? %>
              <%= link_to(raw('<i class="fa fa-globe"></i>'), @user.website_url, target: '_blank', rel: 'nofollow') %>
            <% end %>
            <% if Setting.has_module? :github %>
              <% if !@user.github.blank? %>
                <%= link_to(raw('<i class="fab fa-github"></i>'), @user.github_url, target: '_blank', rel: 'nofollow') %>
              <% end %>
            <% end %>
            <% if !@user.email.blank? && @user.email_public %>
              <a href="mailto: <%= @user.email %>"><i class="fa fa-envelope-o"></i></a>
            <% end %>
          </div>
        </div>
      </div>
      <div class="follow-info row hide-ios">
        <div class="col-sm-4 followers" data-login="<%= @user.login %>">
          <%= link_to @user.followers_count, followers_user_path(@user), class: "counter" %>
          <%= link_to "关注者", followers_user_path(@user), class: "text" %>
        </div>
        <div class="col-sm-4 following">
          <%= link_to @user.following_count, following_user_path(@user), class: "counter" %>
          <%= link_to "正在关注", following_user_path(@user), class: "text" %>
        </div>
        <div class="col-sm-4 stars">
          <%= link_to @user.favorites_count, favorites_user_path(@user), class: "counter" %>
          <%= link_to "收藏", favorites_user_path(@user), class: "text" %>
        </div>
      </div>
      <% if !owner? @user %>
        <div class="buttons row">
          <div class="col-sm-6">
            <%= follow_user_tag(@user) %>
          </div>
          <div class="col-sm-6">
            <%= block_user_tag(@user) %>
          </div>
        </div>
      <% end %>
      <% if !@user.tagline.blank? %>
        <div class="tagline row">
          <%= @user.tagline %>
        </div>
      <% end %>
      <div class="buttons">
        <%= reward_user_tag(@user, class: "btn btn-block btn-default") %>
      </div>
    </div>
  </div>
  <% if Setting.has_module?(:team) %>
    <% if !@user.valid_teams.blank? %>
      <div class="card user-teams">
        <div class="card-body">
          <% @user.valid_teams.each do |team| %>
            <%= user_avatar_tag(team, :md) %>
          <% end %>
        </div>
      </div>
    <% end %>
  <% end %>
  <%= render '/users/repos', user: @user %>
</div>
